<?php
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download JSON</title>
</head>
<body>
<button id="download">Download JSON</button>
<a href="http://ly9asd01.epr.electroluxprofessional.com/DATAHUB/LY/json_debug/DH0120_jde-login_2025-01-07-07.02.02.842737_debug.json" download="file.json">Download JSON</a>
<script>
document.getElementById('download').addEventListener('click', async () => {
const fileUrl = "http://ly9asd01.epr.electroluxprofessional.com/DATAHUB/LY/json_debug/DH0120_jde-login_2025-01-07-07.02.02.842737_debug.json";
try {
// Fetch the JSON file
const response = await fetch(fileUrl);
if (!response.ok) throw new Error("Failed to fetch the file");
// Convert to Blob
const blob = await response.blob();
// Create a temporary download link
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = "file.json"; // Specify download file name
a.click();
// Clean up
URL.revokeObjectURL(url);
} catch (error) {
console.error("Error downloading the file:", error);
}
});
</script>
</body>
</html>